package com.weichuanbo.xwdz.mvp.ui.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.View;

import com.jess.arms.base.BaseActivity;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;
import com.weichuanbo.xwdz.R;
import com.weichuanbo.xwdz.di.component.DaggerSelecteLoginComponent;
import com.weichuanbo.xwdz.di.module.UserModule;
import com.weichuanbo.xwdz.mvp.contract.UserContract;
import com.weichuanbo.xwdz.mvp.presenter.UserPresenter;

import butterknife.ButterKnife;
import butterknife.OnClick;

import static com.jess.arms.utils.Preconditions.checkNotNull;


public class SelecteLoginActivity extends BaseActivity<UserPresenter> implements UserContract.View {

    @Override
    public void setupActivityComponent(@NonNull AppComponent appComponent) {
        DaggerSelecteLoginComponent //如找不到该类,请编译一下项目
                .builder()
                .appComponent(appComponent)
                .userModule(new UserModule(this))
                .build()
                .inject(this);
    }

    @Override
    public int initView(@Nullable Bundle savedInstanceState) {
        //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
        return R.layout.activity_selecte_login;
    }

    @Override
    public void initData(@Nullable Bundle savedInstanceState) {

    }

    @Override
    public void showLoading() {

    }

    @Override
    public void hideLoading() {

    }

    @Override
    public void showMessage(@NonNull String message) {
        checkNotNull(message);
        ArmsUtils.snackbarText(message);
    }

    @Override
    public void launchActivity(@NonNull Intent intent) {
        checkNotNull(intent);
        ArmsUtils.startActivity(intent);
    }

    @Override
    public void killMyself() {
        finish();
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }

    @OnClick({R.id.iv_phone_login, R.id.iv_qq_login, R.id.iv_wx_login})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.iv_phone_login:
                launchActivity(new Intent(SelecteLoginActivity.this, VerificationCodeActivity.class));

                break;
           /* case R.id.iv_qq_login:
                mPresenter.loginByThree(SHARE_MEDIA.QQ);
                break;
            case R.id.iv_wx_login:
                loginByThree(SHARE_MEDIA.WEIXIN);
                break;*/
        }
    }
}
